<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/config.inc.php');
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/top.inc.php');

$section_id = $_GET['sec_id'];
$query = "SELECT *, csm.id AS csm_id, c.id AS cid, csub.id AS sid
 		  FROM course_sections cs
		  JOIN course_section_mapping csm ON csm.course_section_id = cs.id
		  JOIN courses c ON c.id = csm.course_id
		  JOIN course_subjects csub ON csub.id = c.course_subject_id
		  WHERE cs.id = '$section_id'";
$result = mysql_query($query);
$row=mysql_fetch_assoc($result);
$csm_id = $row['csm_id'];
$course_id = $row['cid'];
$subject_id = $row['sid'];

$get_subject_data = mysql_query("SELECT * FROM course_subjects WHERE id = $subject_id");
$subject_name = mysql_result($get_subject_data,0,'subject_title');
$abbreviation = mysql_result($get_subject_data,0,'abbreviation');

$get_course_data = mysql_query("SELECT * FROM courses WHERE id = $course_id");
$course_number = mysql_result($get_course_data,0,'course_number');
$course_name = mysql_result($get_course_data,0,'title');

$get_section_data = mysql_query("SELECT * FROM course_sections WHERE id = $section_id");
$section_number = mysql_result($get_section_data,0,'section_number');

echo "<p>";
	echo "<a href='index.php?sid=$subject_id&id=$course_id'>&lt;&lt; Back to Sections Portal</a><br />";
echo "</p>";
echo "<h1>Delete Section from $abbreviation $course_number</h1>";

//close
mysql_close();

$formatted_section_number = sprintf("%03d", $section_number);

echo "<p>";
echo "Are you sure you want to delete section <b>$formatted_section_number?</p>";

echo "<form action='delete_do.php' method='post'>";
echo "<input type='hidden' name='csm_id' value='$csm_id'>";
echo "<input type='hidden' name='sec_id' value='$section_id'>";
echo "<input type='hidden' name='sid' value='$subject_id'>";
echo "<input type='hidden' name='cid' value='$course_id'>";
echo "<p><input type='submit' value='Yes'></p>";
echo '</form>';





?>
<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/bottom.inc.php');
?>